<template>
  <div class="DocWard">
    <div class="Doc-tit">
      <img src="../../img/wardR/Return.png" alt="请稍等" class="back-icon">
      <span>医生查房</span>
    </div>
    <div class="Doc-con">
      <div class="tab-cut">
        <span class="tab-tit"
          v-for="(item, index) in navList"
          :key="index"
          :class="{'active': nowIndex===index}"
          @click="handleTab(index)"
        >{{item.name}}</span>
      </div>
      <div class="tab-page">
        <swiper :options="swiperOption" ref="mySwiper">
          <swiper-slide>
            <BasicInfo></BasicInfo>
          </swiper-slide>
          <swiper-slide>
            <ChoutOut></ChoutOut>
          </swiper-slide>
          <swiper-slide>
            <Inspection></Inspection>
          </swiper-slide>
          <swiper-slide>
            <Stang></Stang>
          </swiper-slide>
          <swiper-slide>
            <Temporary></Temporary>
          </swiper-slide>
        </swiper>
      </div>
    </div>
  </div>
</template>

<script>
// import Swiper from 'swiper'
import BasicInfo from './BasicInfo'
import ChoutOut from './Stang'
import Inspection from './Temporary'
import Stang from './ChoutOut'
import Temporary from './Inspection'
export default {
  name: 'WardRound',
  components: {
    BasicInfo,
    ChoutOut,
    Inspection,
    Stang,
    Temporary
  },
  data () {
    let self = this
    return {
      swiperOption: {
        autolay: false,
        effect: 'slide',
        loop: false,
        on: {
          slideChangeTransitionEnd (swiper) {
            self.nowIndex = this.activeIndex
          }
        }
      },
      navList: [
        {name: '基本信息'},
        {name: '长期医嘱'},
        {name: '临时医嘱'},
        {name: '检查报告'},
        {name: '检验报告'}
      ],
      nowIndex: 0
    }
  },
  methods: {
    handleTab (index) {
      this.nowIndex = index
      this.swiper.slideTo(index, 300, false)
    }
  },
  computed: {
    swiper () {
      return this.$refs.mySwiper.swiper
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '../../assets/css/variables.styl';
  .DocWard{
    width: 100%;
    height: auto;
  }
  .DocWard .Doc-tit{
    display: flex;
    align-items: center;
    background-color: $bgColor;
    height: .98rem;
    line-height: .98rem;
    font-size: .36rem;
    color: #fff;
  }
  .DocWard .Doc-tit .back-icon{
    width: .2rem;
    height: .3rem;
    margin: 0 .2rem 0 .35rem;
  }
  .DocWard .Doc-con .tab-cut{
    padding: 0 .3rem;
    border-bottom: 1px solid #e8e9ee;
    box-sizing: border-box;
    margin-bottom: .2rem;
  }
  .DocWard .Doc-con .tab-cut .tab-tit{
    margin: 0 .3rem;
    display: inline-block;
    height: .85rem;
    line-height: .85rem;
  }
  .DocWard .Doc-con .tab-cut .tab-tit.active{
    border-bottom: 2px solid #27ae9e;
  }
  .DocWard .Doc-con .tab-page{
    background-color: #f7f8fa;
  }
</style>
